package stud.mpgame.network;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

class TCPNetworkCodecFactory implements ProtocolCodecFactory {

    UserObjectEncoder encoder;
    UserObjectDecoder decoder;

    TCPNetworkCodecFactory(long startAppTime, int protocolVersion, int maxMessageBufferSize) {
        encoder = new UserObjectEncoder(startAppTime, protocolVersion, maxMessageBufferSize);
        decoder = new UserObjectDecoder(startAppTime, protocolVersion);
    }

    public ProtocolEncoder getEncoder(IoSession ioSession) throws Exception {
        return encoder;
    }

    public ProtocolDecoder getDecoder(IoSession ioSession) throws Exception {
        return decoder;
    }

}
